Align DynamoDB batch telemetry with database batch semantics#19034
Draft
trask wants to merge 5 commits into
Draft
Align DynamoDB batch telemetry with database batch semantics#19034trask wants to merge 5 commits into
trask wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates DynamoDB batch telemetry for both AWS SDK 1.11 and 2.2 so that BatchGetItem no longer reports key count as db.operation.batch.size. Under semantic conventions, multiple keys inside a single BatchGetItem request represent operand cardinality, not multiple database operations. BatchWriteItem continues to report batch size and now distinguishes between put, delete, and mixed write operations in the stable operation name.
Changes:
- Removed
BatchGetItemfrom batch size extraction and stable operation name mapping in both SDK versions — it now passes through as the raw"BatchGetItem"operation. - Added write operation type classification (
PutItem,DeleteItem, mixed) toBatchWriteItemhandling, producing stable operation names like"PutItem","BATCH PutItem","BATCH DeleteItem", or"BATCH"for mixed batches. - Replaced individual batch test methods with parameterized
batchScenarios()covering empty, single-item, multi-item, and mixed-type cases for bothBatchGetItemandBatchWriteItem.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
instrumentation/aws-sdk/aws-sdk-2.2/library/…/DynamoDbAttributesExtractor.java |
Removes BatchGetItem from batch logic; adds write-op-type classification and getStableWriteOperationName |
instrumentation/aws-sdk/aws-sdk-1.11/library/…/DynamoDbAttributesExtractor.java |
Parallel changes to SDK 1.11 extractor mirroring SDK 2.2 logic |
instrumentation/aws-sdk/aws-sdk-1.11/library/…/RequestAccess.java |
Adds WriteRequestAccess inner class with reflection-based hasPutRequest/hasDeleteRequest helpers |
instrumentation/aws-sdk/aws-sdk-2.2/testing/…/AbstractAws2ClientCoreTest.java |
Replaces individual batch tests with parameterized BatchScenario-driven test covering all batch variants |
instrumentation/aws-sdk/aws-sdk-1.11/testing/…/AbstractDynamoDbClientTest.java |
Same parameterized test refactoring for SDK 1.11 with request factory helpers |
laurit
reviewed
Jun 19, 2026
Comment on lines
+142
to
150
| private static long countBatchWriteItems(Map<?, ?> requestItems) { | ||
| long count = 0; | ||
| for (Object keysAndAttributes : requestItems.values()) { | ||
| List<?> keys = RequestAccess.getKeys(keysAndAttributes); | ||
| if (keys != null) { | ||
| count += keys.size(); | ||
| for (Object writeRequests : requestItems.values()) { | ||
| if (writeRequests instanceof Collection) { | ||
| count += ((Collection<?>) writeRequests).size(); | ||
| } | ||
| } | ||
| return count; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Align DynamoDB batch telemetry for AWS SDK 1.11 and 2.2 with the database batch-operation clarifications in open-telemetry/semantic-conventions#3811.
BatchGetItemnow keeps its raw operation name and does not emitdb.operation.batch.sizebecause request entries are keys rather than database operations.BatchWriteItemcontinues to report true write batches, including singularPutItem/DeleteItem, homogeneousBATCH PutItem/BATCH DeleteItem, mixedBATCH, anddb.operation.batch.sizefor empty or multi-item batches.